#2015-03-10 00:33:10
#最简单的
PREFIX	:= arm-none-eabi-

export 	CC		:= 	$(PREFIX)gcc
export	LD		:= 	$(PREFIX)ld
export AS		:=	$(PREFIX)as
export OBJCOPY	:= $(PREFIX)objcopy


ARCH	:= -mcpu=arm7tdmi -mabi=apcs-gnu -mthumb \
	#-mlong-calls  #不需要这个，使用这个，内部函数会全部用long-call 。最好还是使用在源码内#program long_calls

#命令是arm-none-eabi-gcc -Wall -O2 -nostdlib -mcpu=arm7tdmi -mabi=apcs-gnu  -mthumb -fno-toplevel-reorder



export CFLAGS	:=	\
			-Wno-return-type \
			-Wall -O2\
			-nostdlib \
			$(ARCH)\
			-fno-toplevel-reorder
			
export LDFLAGS :=

			
#-fno-toplevel-reorder
#取消置顶优化(变量位置按源码位置编译,如果没有这个选项,会优化位置)
			
			
sub_%.o:sub_%.c
	$(CC) $(CFLAGS) -c -MMD -MF"$*.d" $(CURDIR)/$< -o $@ -mlong-calls

%.o:%.c
	$(CC) $(CFLAGS) -c -MMD -MF"$*.d" $(CURDIR)/$< -o $@ -mlong-calls

